<template>
  <xh-container btnText="保存" @onSave="handleClickSubmit" title="编辑">
    <view
      class="form-container"
      :style="{ height: ` calc(100vh - 46px - ${bottomHeight})` }"
    >
      <uni-forms :modelValue="formData" :label-width="80" label-align="right">
        <uni-forms-item label="产品名称" name="productName">
          <uni-data-select
            v-model="formData.productName"
            :localdata="productList"
          ></uni-data-select>
        </uni-forms-item>
        <uni-forms-item label="检验编码" name="insCode">
          <uni-easyinput
            type="text"
            v-model="formData.insCode"
            placeholder="请输入检验编码"
          />
        </uni-forms-item>

        <uni-forms-item label="生产厂家" name="factory">
          <uni-data-select
            v-model="formData.factory"
            :localdata="mobileInboundList"
          ></uni-data-select>
        </uni-forms-item>
        <uni-forms-item label="卷数" name="volumeNum">
          <uni-easyinput
            type="text"
            v-model="formData.volumeNum"
            placeholder="请输入卷数"
          />
        </uni-forms-item>
        <uni-forms-item label="米数" name="meters">
          <uni-easyinput
            type="text"
            v-model="formData.meters"
            placeholder="请输入数量"
          />
        </uni-forms-item>
      </uni-forms>
    </view>
  </xh-container>
</template>

<script>
import { mapGetters } from "vuex";
import { editInbound } from "@/api/purchase/fabric.js";
import { decodeParams } from "@/utils/common.js";
import mixins from "../mixins";

export default {
  mixins: [mixins],
  data() {
    return {
      formData: {},
    };
  },
  computed: {
    ...mapGetters(["mobileInboundList"]),
  },
  onLoad(options) {
    this.formData = decodeParams(options);
  },
  created() {},
  methods: {
    handleClickSubmit() {
      editInbound(this.formData).then(() => {
        this.$modal.msgSuccess("编辑成功！");
        this.$nav.navigateBack();
      });
    },
  },
};
</script>

<style scoped lang="scss">
.form-container {
  padding: 10px;
  overflow-y: auto;
}
</style>
